# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

SLOT="0"
LICENSE="GPL-3"
KEYWORDS="~x86 ~amd64"
DESCRIPTION="Proxy tool swithcer"
IUSE="firefox thunderbird"
SRC_URI="ftp://foo.bar.com/${PN}-${PV}.tar.bz2"

DEPEND="firefox? (  www-client/mozilla-firefox )
        thunderbird? (  mail-client/mozilla-thunderbird )"

RDEPEND="${DEPEND}
        sys-apps/sed
	app-shells/bash"

src_unpack () {
 unpack ${A}
}


src_compile() {
 if use firefox
 then
  cp usr/bin/wrapper-proxy usr/bin/firefox-proxy
 fi
 if use thunderbird
 then
  cp usr/bin/wrapper-proxy usr/bin/thunderbird-proxy
 fi	
 rm  usr/bin/wrapper-proxy
}

src_install() {
 cp * -R ${D}
}

pkg_postinst(){
 if use firefox
 then
	echo "Install firefox plugin: https://addons.mozilla.org/it/firefox/addon/3896"
 fi
 if use thunderbird
 then
	echo "Install thunderbird plugin: https://addons.mozilla.org/it/thunderbird/addon/3896"
 fi
 echo "Do echo  source /etc/proxy >> /etc/bash/bashrc"

}
